In the event of technical difficulties with Szkopuł, please contact us via email at [email protected].
If you would like to talk about tasks, solutions or technical problems, please visit our Discord servers. They are moderated by the community, but members of the support team are also active there.
A mirror trap is a cuboid made of mirrors, the reflecting sides of which are facing the interior of the cuboid. Precisely in the geometric centre of the cuboid there is a miniature laser (whose dimensions we shall neglect). The task is to aim the laser in such a way that the beam travels the longest total distance possible and returns to the laser itself. By total distance we shall denote the sum of distances traveled by the laser beam in each of the three directions parallel to the edges of the mirrors (i.e. we are using the so called Manhattan (city) metric).
The dimensions of the trap are even integers. The edges and vertices of the trap, where distinct sides meet, do not reflect the laser beam. Inside the cuboid we shall introduce a cartesian coordinate system. Its axes are parallel to the edges of the trap and the laser shall be placed in the origin. The laser may be aimed at any integer point (a point whose all coordinates are integers) within the trap, the points on the surface of the mirrors included (with the single exception of the laser itself, i.e. the point ).
Write a programme which:
A single test consists of many mirror traps to be analysed. The first line of the standard input contains a single integer , denoting the number of traps to be analysed. In the lines there are descriptions of the traps, a single per line. The description of the trap consists of three numbers , separated by single spaces. The mirror trap has the dimensions of .
Your programme should write exactly lines to the standard output. The 'th line should contain a solution for the 'th trap: three integers , , , separated by single spaces, , , , . Those numbers signify that in the 'th trap the laser should be aimed at the point, whose coordinates are .
Should there be a greater number of correct solutions, your programme ought to write out any one of them.
For the input data:
2 5 6 7 5 6 6
the correct result is:
4 5 6 4 6 5
Task author: Zbigniew Czech.